home *** CD-ROM | disk | FTP | other *** search
/ BCI NET / BCI NET Dec 94.iso / archives / programming / source / jade-3.2.lha / jade-3.2 / man / jade.info-6 < prev    next >
Encoding:
GNU Info File  |  1994-10-16  |  47.6 KB  |  1,334 lines

  1. This is Info file jade.info, produced by Makeinfo-1.55 from the input
  2. file jade.texi.
  3.  
  4. START-INFO-DIR-ENTRY
  5. * Jade: (jade).            An editor for X11 and AmigaDOS
  6. END-INFO-DIR-ENTRY
  7.  
  8.    This is Edition 1.3, last updated 7 October 1994, of `The Jade
  9. Manual', for Jade, Version 3.2.
  10.  
  11.    Jade is a text editor for X11 (on Unix) and the Amiga.
  12.  
  13.    Copyright 1993, 1994 John Harper.
  14.  
  15.    Permission is granted to make and distribute verbatim copies of this
  16. manual provided the copyright notice and this permission notice are
  17. preserved on all copies.
  18.  
  19.    Permission is granted to copy and distribute modified versions of
  20. this manual under the conditions for verbatim copying, provided that
  21. the entire resulting derived work is distributed under the terms of a
  22. permission notice identical to this one.
  23.  
  24. 
  25. File: jade.info,  Node: Macro Expansion,  Next: Compiling Macros,  Prev: Defining Macros,  Up: Macros
  26.  
  27. Macro Expansion
  28. ---------------
  29.  
  30.    When a macro call is detected (*note List Forms::.) the function
  31. which is the cdr of the macro's definition (*note Defining Macros::.)
  32. is applied to the macro call's arguments. Unlike in a function call,
  33. the arguments are *not evaluated*, the actual forms are the arguments
  34. to the macro's expansion function. This is so these forms can be
  35. rearranged by the macro's expansion function to create the new form
  36. which will be evaluated.
  37.  
  38.    There is a function which performs macro expansion, its main use is
  39. to let the Lisp compiler expand macro calls at compile time.
  40.  
  41.  - Function: macroexpand FORM &optional ENVIRONMENT
  42.      If FORM is a macro call `macroexpand' will expand that call by
  43.      calling the macro's expansion function (the cdr of the macro
  44.      definition).  If this expansion is another macro call the process
  45.      is repeated until an expansion is obtained which is not a macro
  46.      call, this form is then returned.
  47.  
  48.      The optional ENVIRONMENT argument is an alist of macro definitions
  49.      to use as well as the existing macros; this is mainly used for
  50.      compiling purposes.
  51.  
  52.           (defmacro when (condition &rest body)
  53.             "Evaluates CONDITION, if it's non-`nil' evaluates the BODY
  54.           forms."
  55.             (list 'if condition (cons 'progn body)))
  56.               => when
  57.           
  58.           (macroexpand '(when x (setq foo bar)))
  59.               => (if x (progn (setq foo bar)))
  60.  
  61. 
  62. File: jade.info,  Node: Compiling Macros,  Prev: Macro Expansion,  Up: Macros
  63.  
  64. Compiling Macros
  65. ----------------
  66.  
  67.    Although it may seem odd that macros return a form to produce a
  68. result and not simply the result this is their most important feature.
  69. It allows the expansion and the evaluation of the expansion to happen
  70. at different times.
  71.  
  72.    The Lisp compiler makes use of this; when it comes across a macro
  73. call in a form it is compiling it uses the `macroexpand' function to
  74. produce the expansion of that form which it then compiles straight into
  75. the object code. Obviously this is good for performance (why evaluate
  76. the expansion every time it is needed when once will do?).
  77.  
  78.    Some rules do need to be observed to make this work properly:
  79.  
  80.    * When the compiler compiles a file it remembers the macros which
  81.      have been defined by that file; it can only expand a macro call if
  82.      the definition of the macro appears before the macro call itself
  83.      (it can't read your mind).
  84.  
  85.    * The macro expansion function (i.e. the definition of the macro)
  86.      should not have any side effects or evaluate its arguments (the
  87.      value of a symbol at compile-time probably won't be the same as
  88.      its value at run-time).
  89.  
  90.    * Macros which are defined by another file must be loaded so they
  91.      can be recognised. Use the `require' function, the compiler will
  92.      evaluate any top-level `require' forms it sees to bring in any
  93.      macro definitions used.
  94.  
  95. 
  96. File: jade.info,  Node: Streams,  Next: Loading,  Prev: Macros,  Up: Programming Jade
  97.  
  98. Streams
  99. =======
  100.  
  101.    A "stream" is a Lisp object which is either a data sink (an "output
  102. stream") or a data source (an "input stream"). In Jade all streams
  103. produce or consume sequences of 8-bit characters.
  104.  
  105.    Streams are very flexible, functions using streams for their input
  106. and output do not need to know what type of stream it is. For example
  107. the Lisp reader (the `read' function) takes an input stream as its one
  108. argument, it then reads characters from this stream until it has parsed
  109. a whole object. This stream could be a file, a position in a buffer, a
  110. function or even a string; the `read' function can not tell the
  111. difference.
  112.  
  113.  - Function: streamp OBJECT
  114.      This function returns `t' if its argument is a stream.
  115.  
  116. * Menu:
  117.  
  118. * Input Streams::               Types of input stream
  119. * Output Streams::              Types of output stream
  120. * Input Functions::             Functions to read from streams
  121. * Output Functions::            How to output to a stream
  122.  
  123. 
  124. File: jade.info,  Node: Input Streams,  Next: Output Streams,  Up: Streams
  125.  
  126. Input Streams
  127. -------------
  128.  
  129.    These are the possible types of input stream, for the functions which
  130. use them see *Note Input Functions::.
  131.  
  132. `FILE'
  133.      Characters are read from the file object FILE, for the functions
  134.      which manipulate file objects see *Note Files::.
  135.  
  136. `MARK'
  137.      The marker MARK points to the next character that will be read.
  138.      Each time a character is read the position that MARK points to will
  139.      be advanced to the following character. *Note Marks::.
  140.  
  141. `BUFFER'
  142.      Reads from the position of the cursor in the buffer BUFFER. This
  143.      position is advanced as characters are read.
  144.  
  145. `(BUFFER . POSITION)'
  146.      Characters are read from the position POSITION in the buffer
  147.      BUFFER.  POSITION is advanced to the next character as each
  148.      character is read.
  149.  
  150. `FUNCTION'
  151.      Each time an input character is required the FUNCTION is called
  152.      with no arguments. It should return the character read (an
  153.      integer) or `nil' if for some reason no character is available.
  154.  
  155.      FUNCTION should also be able to `unread' one character. When this
  156.      happens the function will be called with one argument -- the value
  157.      of the last character read. The function should arrange it so that
  158.      the next time it is called it returns this character. A possible
  159.      implementation could be,
  160.  
  161.           (defvar ms-unread-char nil
  162.             "If non-nil the character which was pushed back.")
  163.           
  164.           (defun my-stream (&optional unread-char)
  165.             (if unread-char
  166.                 (setq ms-unread-char unread-char)
  167.               (if ms-unread-char
  168.                   (prog1
  169.                     ms-unread-char
  170.                     (setq ms-unread-char nil))
  171.                 ;; Normal case -- read and return a character from somewhere
  172.                 ...
  173.  
  174. `nil'
  175.      Read from the stream stored in the variable `standard-input'.
  176.  
  177.    It is also possible to use a string as an input stream. The string to
  178. be read from must be applied to the `make-string-input-stream' function
  179. and the result from this function used as the input stream.
  180.  
  181.  - Function: make-string-input-stream STRING &optional START
  182.      Returns an input stream which will supply the characters of the
  183.      string STRING in order starting with the character at position
  184.      START (or from position zero if this argument is undefined).
  185.  
  186.           (read (make-string-input-stream "(1 . 2)"))
  187.               => (1 . 2)
  188.  
  189.  - Variable: standard-input
  190.      The input stream which is used when no other is specified or is
  191.      `nil'.
  192.  
  193. 
  194. File: jade.info,  Node: Output Streams,  Next: Input Functions,  Prev: Input Streams,  Up: Streams
  195.  
  196. Output Streams
  197. --------------
  198.  
  199.    These are the different types of output stream, for the functions
  200. which use them see *Note Output Functions::.
  201.  
  202. `FILE'
  203.      Writes to the file object FILE. *Note Files::.
  204.  
  205. `MARK'
  206.      Writes to the position pointed to by the marked MARK, then
  207.      advances the position of the mark.
  208.  
  209. `BUFFER'
  210.      Writes to BUFFER at the position of the cursor in that buffer,
  211.      which is then advanced.
  212.  
  213. `(BUFFER . POSITION)'
  214.      POSITION in the buffer BUFFER. POSITION is then moved over the
  215.      written text.
  216.  
  217. `(BUFFER . t)'
  218.      Writes to the end of the buffer BUFFER.
  219.  
  220. `FUNCTION'
  221.      The function FUNCTION is called with one argument, either a string
  222.      or a character. This should be used as the circumstances dictate.
  223.      If the function returns a number it is the number of characters
  224.      actually used, otherwise it is assumed that all the characters
  225.      were successful.
  226.  
  227. `PROCESS'
  228.      Writes to the standard input of the process object PROCESS. If
  229.      PROCESS isn't running an error is signalled. *Note Processes::.
  230.  
  231. `t'
  232.      Appends the character(s) to the end of the status line message.
  233.  
  234. `nil'
  235.      Write to the stream stored in the variable `standard-output'.
  236.  
  237.    It is also possible to store the characters sent to an output stream
  238. in a string.
  239.  
  240.  - Function: make-string-output-stream
  241.      Returns an output stream. It accumulates the text sent to it for
  242.      the benefit of the `get-output-stream-string' function.
  243.  
  244.  - Function: get-output-stream-string STRING-OUTPUT-STREAM
  245.      Returns a string consisting of the text sent to the
  246.      STRING-OUTPUT-STREAM since the last call to
  247.      GET-OUTPUT-STREAM-STRING (or since this stream was created by
  248.      `make-string-output-stream').
  249.  
  250.           (setq stream (make-string-output-stream))
  251.               => ("" . 0)
  252.           (prin1 keymap-path stream)
  253.               => ("(lisp-mode-keymap global-keymap)" . 64)
  254.           (get-output-stream-string stream)
  255.               => "(lisp-mode-keymap global-keymap)"
  256.  
  257.  - Variable: standard-output
  258.      This variable contains the output stream which is used when no
  259.      other is specified (or when the given output stream is `nil').
  260.  
  261. 
  262. File: jade.info,  Node: Input Functions,  Next: Output Functions,  Prev: Output Streams,  Up: Streams
  263.  
  264. Input Functions
  265. ---------------
  266.  
  267.  - Function: read-char STREAM
  268.      Read and return the next character from the input stream STREAM. If
  269.      the end of the stream is reached `nil' is returned.
  270.  
  271.  - Function: read-line STREAM
  272.      This function reads one line of characters from the input stream
  273.      STREAM, creates a string containing the line (including the
  274.      newline character which terminates the line) and returns it.
  275.  
  276.      If the end of stream is reached before any characters can be read
  277.      `nil' is returned, if the end of stream is reached but some
  278.      characters have been read (but not the newline) these characters
  279.      are made into a string and returned.
  280.  
  281.      Note that unlike the Common Lisp function of the same name, the
  282.      newline character is not removed from the returned string.
  283.  
  284.  - Function: read STREAM
  285.      This function is the function which contains the Lisp reader
  286.      (*note The Lisp Reader::.). It reads as many characters from the
  287.      input stream STREAM as it needs to make the read syntax of a single
  288.      Lisp object (*note Read Syntax::.), this object is then returned.
  289.  
  290.  - Function: read-from-string STRING &optional START
  291.      Reads one Lisp object from the string STRING, the first character
  292.      is read from position START (or position zero).
  293.  
  294.           (read-from-string STRING START)
  295.           ==
  296.           (read (make-string-input-stream STRING START))
  297.  
  298. 
  299. File: jade.info,  Node: Output Functions,  Prev: Input Functions,  Up: Streams
  300.  
  301. Output Functions
  302. ----------------
  303.  
  304.  - Function: write STREAM DATA &optional LENGTH
  305.      Writes the specified character(s) to the output stream STREAM.
  306.      dATA is either the character or the string to be written. If DATA
  307.      is a string the optional argument LENGTH may specify how many
  308.      characters are to be written. The value returned is the number of
  309.      characters successfully written.
  310.  
  311.           (write standard-output "Testing 1.. 2.. 3..")
  312.               -| Testing 1.. 2.. 3..
  313.               => 19
  314.  
  315.  - Function: copy-stream INPUT-STREAM OUTPUT-STREAM
  316.      This function copies all characters which may be read from
  317.      INPUT-STREAM to OUTPUT-STREAM. The copying process is not stopped
  318.      until the end of the input stream is read. Returns the number of
  319.      characters copied.
  320.  
  321.      Be warned, if you don't choose the streams carefully you may get a
  322.      deadlock which only an interrupt signal can break!
  323.  
  324.  - Function: print OBJECT &optional STREAM
  325.      Outputs a newline character to the output stream STREAM, then
  326.      writes a textual representation of OBJECT to the stream.
  327.  
  328.      If possible, this representation will be such that `read' can turn
  329.      it into an object structurally similar to OBJECT. This will *not*
  330.      be possible if OBJECT does not have a read syntax.
  331.  
  332.      OBJECT is returned.
  333.  
  334.           (print '(1 2 3))
  335.               -|
  336.               -| (1 2 3)
  337.               => (1 2 3)
  338.  
  339.  - Function: prin1 OBJECT &optional STREAM
  340.      Similar to `print' but no initial newline is output.
  341.  
  342.           (prin1 '(1 2 3))
  343.               -| (1 2 3)
  344.               => (1 2 3)
  345.           
  346.           (prin1 '|(xy((z]|)              ;A strange symbol
  347.               -| \(xy\(\(z\]
  348.               => \(xy\(\(z\]
  349.  
  350.  - Function: prin1-to-string OBJECT
  351.      Returns a string containing the characters that `prin1' would
  352.      output when it prints OBJECT.
  353.  
  354.           (prin1-to-string '(1 2 3))
  355.               => "(1 2 3)"
  356.  
  357.  - Function: princ OBJECT &optional STREAM
  358.      Prints a textual representation of OBJECT to the output stream
  359.      STREAM. No steps are taken to create output that `read' can parse
  360.      and no quote characters surround strings.
  361.  
  362.           (princ "foo")
  363.               -| foo
  364.               => "foo"
  365.           
  366.           (princ '|(xy((z]|)
  367.               -| (xy((z]
  368.               => \(xy\(\(z\]
  369.  
  370.  - Function: format STREAM TEMPLATE &rest VALUES
  371.      Writes to a stream, STREAM, a string constructed from the format
  372.      string, TEMPLATE, and the argument VALUES.
  373.  
  374.      If STREAM is `nil' the resulting string will be returned, not
  375.      written to a stream.
  376.  
  377.      TEMPLATE is a string which may contain format specifiers, these are
  378.      a `%' character followed by another character telling how to print
  379.      the next of the VALUES. The following options are available
  380.  
  381.     `s'
  382.           Write the printed representation of the value without quoting
  383.           (as if from the `princ' function).
  384.  
  385.     `S'
  386.           Write the printed representation *with* quoting enabled (like
  387.           the `prin1' function).
  388.  
  389.     `d'
  390.           Output the value as a decimal number.
  391.  
  392.     `o'
  393.           Write the value in octal.
  394.  
  395.     `x'
  396.           In hexadecimal.
  397.  
  398.     `c'
  399.           Write the character specified by the value.
  400.  
  401.     `%'
  402.           Print a literal percent character. None of the VALUES are
  403.           used.
  404.  
  405.      The function works through the TEMPLATE a character at a time. If
  406.      the character is a format specifier (a `%') it inserts the correct
  407.      string (as defined above) into the output. Otherwise, the
  408.      character is simply put into the output stream.
  409.  
  410.      If STREAM isn't `nil' (i.e. the formatted string is returned) the
  411.      value of STREAM is returned.
  412.  
  413.           (format nil "foo %S bar 0x%x" '(x . y) 255)
  414.               => "foo (x . y) bar 0xff"
  415.           
  416.           (format standard-output "The %s is %s!" "dog" "purple")
  417.               -| The dog is purple!
  418.               => #<buffer *jade*>
  419.  
  420. 
  421. File: jade.info,  Node: Loading,  Next: Compiled Lisp,  Prev: Streams,  Up: Programming Jade
  422.  
  423. Loading
  424. =======
  425.  
  426.    In Lisp, programs (also called "modules") are stored in files. Each
  427. file is a sequence of Lisp forms (known as "top-level forms"). Most of
  428. the top-level forms in a program will be definitions (i.e. function,
  429. macro or variable definitions) since generally each module is a system
  430. of related functions and variables.
  431.  
  432.    Before the program can be used it has to be "loaded" into the
  433. editor's workspace; this involves reading and evaluating each top-level
  434. form in the file.
  435.  
  436. * Menu:
  437.  
  438. * Load Function::               The function which loads programs
  439. * Autoloading::                 Functions can be loaded on reference
  440. * Features::                    Module management functions
  441.  
  442. 
  443. File: jade.info,  Node: Load Function,  Next: Autoloading,  Up: Loading
  444.  
  445. Load Function
  446. -------------
  447.  
  448.  - Function: load PROGRAM &optional NO-ERROR NO-PATH NO-SUFFIX
  449.      This function loads the file containing the program called PROGRAM;
  450.      first the file is located then each top-level form contained by
  451.      the file is read and evaluated in order.
  452.  
  453.      Each directory named by the variable `load-path' is searched until
  454.      the file containing PROGRAM is found. In each directory three
  455.      different file names are tried,
  456.  
  457.        1. PROGRAM with `.jlc' appended to it. Files with a `.jlc'
  458.           suffix are usually compiled Lisp files. *Note Compiled Lisp::.
  459.  
  460.        2. PROGRAM with `.jl' appended, most uncompiled Lisp programs are
  461.           stored in files with names like this.
  462.  
  463.        3. PROGRAM with no modifications.
  464.  
  465.      If none of these gives a result the next directory is searched in
  466.      the same way, when all directories in `load-path' have been
  467.      exhausted and the file still has not been found an error is
  468.      signalled.
  469.  
  470.      Next the file is opened for reading and Lisp forms are read from it
  471.      one at a time, each form is evaluated before the next form is
  472.      read. When the end of the file is reached the file has been loaded
  473.      and this function returns `t'.
  474.  
  475.      The optional arguments to this function are used to modify its
  476.      behaviour,
  477.  
  478.     NO-ERROR
  479.           When this argument is non-`nil' no error is signalled if the
  480.           file can not be located. Instead the function returns `nil'.
  481.  
  482.     NO-PATH
  483.           The variable `load-path' is not used, PROGRAM must point to
  484.           the file from the current working directory.
  485.  
  486.     NO-SUFFIX
  487.           When non-`nil' no `.jlc' or `.jl' suffixes are applied to the
  488.           PROGRAM argument when locating the file.
  489.  
  490.      If a version of the program whose name ends in `.jlc' is older than
  491.      a `.jl' version of the same file (i.e. the source code is newer
  492.      than the compiled version) a warning is displayed and the `.jl'
  493.      version is used.
  494.  
  495.           (load "foobar")
  496.               error--> File error: Can't open lisp-file, foobar
  497.           
  498.           (load "foobar" t)
  499.               => nil
  500.  
  501.  - Variable: load-path
  502.      A list of strings, each element is the name of a directory which is
  503.      prefixed to the name of a program when Lisp program files are being
  504.      searched for.
  505.  
  506.           load-path
  507.               => ("" "/usr/local/lib/jade/3.2/lisp/")
  508.  
  509.      The element `""' means the current directory, note that directory
  510.      names should have an ending `/' (or whatever) so that when
  511.      concatenated with the name of the file they make a meaningful
  512.      filename.
  513.  
  514.  - Variable: lisp-lib-dir
  515.      The name of the directory in which the standard Lisp files are
  516.      stored.
  517.  
  518.           lisp-lib-dir
  519.               => "/usr/local/lib/jade/3.2/lisp/"
  520.  
  521. 
  522. File: jade.info,  Node: Autoloading,  Next: Features,  Prev: Load Function,  Up: Loading
  523.  
  524. Autoloading
  525. -----------
  526.  
  527.    Obviously, not all the features of the editor are always used.
  528. "Autoloading" allows modules to be loaded when they are referenced.
  529. This speeds up the initialisation process and may save memory.
  530.  
  531.    Functions which may be autoloaded have a special form in their
  532. symbol's function cell -- an autoload form. This is a list whose first
  533. element is the symbol `autoload'. When the function call dispatcher
  534. finds one of these forms it loads the program file specified in the form
  535. then re-evaluates the function call. The true function definition will
  536. have been loaded and therefore the call may proceed as normal.
  537.  
  538.    The structure of an autoload form is:
  539.  
  540.      (autoload PROGRAM-FILE [IS-COMMAND])
  541.  
  542.    PROGRAM-FILE is the argument to give to the `load' function when the
  543. function is to be loaded. It should be the program containing a
  544. definition of the autoloaded function.
  545.  
  546.    The optional IS-COMMAND object specifies whether or not the function
  547. may be called interactively (i.e. it is an editor command).
  548.  
  549.  - Function: autoload SYMBOL &rest AUTOLOAD-DEFN
  550.      Installs an autoload form into the function cell of the symbol
  551.      SYMBOL.  The form is a cons cell whose car is `autoload' and whose
  552.      cdr is the argument AUTOLOAD-DEFN.
  553.  
  554.      Returns the resulting autoload form.
  555.  
  556.           (autoload 'foo "foos-file")
  557.               => (autoload "foos-file")
  558.           (symbol-function 'foo)
  559.               => (autoload "foos-file")
  560.           
  561.           (autoload 'bar "bars-file" t)
  562.               => (autoload "bars-file" t)
  563.           (commandp 'bar)
  564.               => t
  565.  
  566.    It is not necessary to call the `autoload' function manually. Simply
  567. prefix the definitions of all the functions which may be autoloaded
  568. (i.e.  the entry points to your module; *not* all the internal
  569. functions!) with the magic comment `;;;###autoload'. Then the
  570. `add-autoloads' command can be used to create the necessary calls to
  571. the autoload function in the `autoloads.jl' Lisp file (this file which
  572. lives in the Lisp library directory is loaded when the editor is
  573. initialised).
  574.  
  575. `Meta-x add-autoloads'
  576.      Scans the current buffer for any autoload definitions. Functions
  577.      with the comment `;;;###autoload' preceding them have autoload
  578.      forms inserted into the `autoloads.jl' file. Simply save this
  579.      file's buffer and the new autoloads will be used the next time
  580.      Jade is initialised.
  581.  
  582.      It is also possible to mark arbitrary forms for inclusion in the
  583.      `autoloads.jl' file: put them on a single line which starts with
  584.      the comment `;;;###autoload' call the command.
  585.  
  586.      The unsaved `autoloads.jl' buffer will become the current buffer.
  587.  
  588.           ;;;###autoload
  589.           (defun foo (bar)                ;`foo' is to be autoloaded
  590.             ...
  591.           
  592.           ;;;###autoload (setq x y)       ;Form to eval on initialisation
  593.  
  594. `Meta-x remove-autoloads'
  595.      Remove all autoload forms from the `autoloads.jl' file which are
  596.      marked by the `;;;###autoload' comment in the current buffer.
  597.  
  598.      The unsaved `autoloads.jl' buffer will become the current buffer.
  599.  
  600. 
  601. File: jade.info,  Node: Features,  Prev: Autoloading,  Up: Loading
  602.  
  603. Features
  604. --------
  605.  
  606.    "Features" correspond to modules of the editor. Each feature is
  607. loaded separately. Each feature has a name, when a certain feature is
  608. required its user asks for it to be present (with the `require'
  609. function), the feature may then be used as normal.
  610.  
  611.    When a feature is loaded one of the top-level forms evaluated is a
  612. call to the `provide' function. This names the feature and installs it
  613. into the list of present features.
  614.  
  615.  - Variable: features
  616.      A list of the features currently present (that is, loaded). Each
  617.      feature is represented by a symbol. Usually the print name of the
  618.      symbol (the name of the feature) is the same as the name of the
  619.      file it was loaded from, minus any `.jl' or `.jlc' suffix.
  620.  
  621.           features
  622.               => (info isearch fill-mode texinfo-mode lisp-mode xc)
  623.  
  624.  - Function: provide FEATURE
  625.      Adds FEATURE (a symbol) to the list of features present. A call to
  626.      this function is normally one of the top-level forms in a module.
  627.  
  628.           ;;;; maths.jl -- the `maths' module
  629.           
  630.           (provide 'maths)
  631.           ...
  632.  
  633.  - Function: require FEATURE &optional FILE
  634.      Show that the caller is planning to use the feature FEATURE (a
  635.      symbol).  This function will check the `features' variable to see
  636.      if FEATURE is already loaded, if so it will return immediately.
  637.  
  638.      If FEATURE is not present it will be loaded. If FILE is non-`nil'
  639.      it specifies the first argument to the `load' function, else the
  640.      print name of the symbol FEATURE is used.
  641.  
  642.           ;;;; physics.jl -- the `physics' module
  643.           
  644.           (require 'maths)                ;Need the `maths' module
  645.           (provide 'physics)
  646.           ...
  647.  
  648. 
  649. File: jade.info,  Node: Compiled Lisp,  Next: Hooks,  Prev: Loading,  Up: Programming Jade
  650.  
  651. Compiled Lisp
  652. =============
  653.  
  654.    Jade contains a rudimentary Lisp compiler; this takes a Lisp form or
  655. program and compiles it into a "byte-code" form. This byte-code form
  656. contains a string of byte instructions, a vector of data constants and
  657. some other information.
  658.  
  659.    The main reason for compiling your programs is to increase their
  660. speed, it is difficult to quantify the speed increase gained -- some
  661. programs (especially those using a lot of macros) will execute many
  662. times quicker than their uncompiled version whereas others may only
  663. execute a bit quicker.
  664.  
  665. * Menu:
  666.  
  667. * Compilation Functions::       How to compile Lisp programs
  668. * Compilation Tips::            Getting the most out of the compiler
  669. * Disassembly::                 Examining compiled functions
  670.  
  671. 
  672. File: jade.info,  Node: Compilation Functions,  Next: Compilation Tips,  Up: Compiled Lisp
  673.  
  674. Compilation Functions
  675. ---------------------
  676.  
  677.  - Function: compile-form FORM
  678.      This function compiles the Lisp form FORM into a byte-code form
  679.      which is returned.
  680.  
  681.           (compile-form '(setq foo bar))
  682.               => (jade-byte-code "F!" [bar foo] 2)
  683.  
  684.  - Command: compile-file FILE-NAME
  685.      This function compiles the file called FILE-NAME into a file of
  686.      compiled Lisp forms whose name is FILE-NAME with `c' appended to
  687.      it (i.e. if FILE-NAME is `foo.jl' it will be compiled to
  688.      `foo.jlc').
  689.  
  690.      If an error occurs while the file is being compiled any
  691.      semi-written file will be deleted.
  692.  
  693.      When called interactively this function will ask for the value of
  694.      FILE-NAME.
  695.  
  696.  - Command: compile-directory DIRECTORY &optional FORCE EXCLUDE
  697.      Compiles all the Lisp files in the directory called DIRECTORY which
  698.      either haven't been compiled or whose compiled version is older
  699.      than the source file (Lisp files are those ending in `.jl').
  700.  
  701.      If the optional argument FORCE is non-`nil' *all* Lisp files will
  702.      be recompiled whatever the status of their compiled version.
  703.  
  704.      The EXCLUDE argument may be a list of filenames, these files will
  705.      *not* be compiled.
  706.  
  707.      When this function is called interactively it prompts for the
  708.      directory.
  709.  
  710.  - Function: compile-lisp-lib &optional FORCE
  711.      Uses `compile-directory' to compile the library of standard Lisp
  712.      files.  If FORCE is non-`nil' all of these files will be compiled.
  713.  
  714.      The `autoloads.jl' is *never* compiled since it is often modified
  715.      and wouldn't really benefit from compilation anyway.
  716.  
  717.  - Function: jade-byte-code BYTE-CODES CONSTANTS MAX-STACK
  718.      Interprets the string of byte instructions BYTE-CODES with the
  719.      vector of constants CONSTANTS. MAX-STACK defines the maximum
  720.      number of stack cells required to interpret the code.
  721.  
  722.      This function is *never* called by hand. The compiler will produce
  723.      calls to this function when it compiles a form or a function.
  724.  
  725.           (setq x 1
  726.                 y 3)
  727.               => 3
  728.           (setq comp (compile-form '(cons x y)))
  729.               => (jade-byte-code "K" [x y] 2)
  730.           (eval comp)
  731.               => (1 . 3)
  732.  
  733. 
  734. File: jade.info,  Node: Compilation Tips,  Next: Disassembly,  Prev: Compilation Functions,  Up: Compiled Lisp
  735.  
  736. Compilation Tips
  737. ----------------
  738.  
  739.    Here are some tips for making compiled code run fast:
  740.  
  741.    * Always favour iteration over recursion; function calls are
  742.      relatively slow. The compiler doesn't know about tail recursion or
  743.      whatever so you'll have to do this explicitly.
  744.  
  745.      For example, the most elegant way of searching a list is to use
  746.      recursion,
  747.  
  748.           (defun scan-list (list elt)
  749.             "Search the LIST for an element ELT. Return it if one is found."
  750.             (if (eq (car list) elt)
  751.                 elt
  752.               (scan-list (cdr list) elt)))
  753.  
  754.      but this is fairly slow. Instead, iterate through each element,
  755.  
  756.           (defun scan-list (list elt)
  757.             (while (consp list)
  758.               (when (eq (car list) elt)
  759.                 (return elt))
  760.               (setq list (cdr list))))
  761.  
  762.    * In some cases the functions `member', `memq', `assoc', etc... can
  763.      be used to search lists. Since these are primitives written in C
  764.      they will run *much* faster than an equivalent Lisp function.
  765.  
  766.      So the above `scan-list' example can be rewritten as,
  767.  
  768.           (defun scan-list (list elt)
  769.             (car (memq elt list)))
  770.  
  771.      Also note that the `mapcar' and `mapc' functions are useful (and
  772.      efficient) when using lists.
  773.  
  774.    * Whenever possible use the `when' and `unless' conditional
  775.      structures; they are more efficient than `cond' or `if'.
  776.  
  777.    * Careful use of named constants (*note Constant Variables::.) can
  778.      increase the speed of some programs. For example, in the Lisp
  779.      compiler itself all the opcode values (small integers) are defined
  780.      as constants.
  781.  
  782.      I must stress that in some cases constants are *not* suitable;
  783.      they may drastically increase the size of the compiled program
  784.      (when the constants are `big' objects, i.e. long lists) or even
  785.      introduce subtle bugs (since two references to the same constant
  786.      may not be `eq' whereas two references to the same variable are
  787.      always `eq').
  788.  
  789.    * Many primitives have corresponding byte-code instructions; these
  790.      primitives will be quicker to call than those that don't (and
  791.      incur a normal function call). Currently, the functions which have
  792.      byte-code instructions (apart from all the special forms) are:
  793.  
  794.      `cons', `car', `cdr', `rplaca', `rplacd', `nth', `nthcdr', `aset',
  795.      `aref', `length', `eval', `+', `*', `/', `%', `lognot', `not',
  796.      `logior', `logand', `equal', `eq', `=', `/=', `>', `<', `>=',
  797.      `<=', `1+', `1-', `-', `set', `fset', `lsh', `zerop', `null',
  798.      `atom', `consp', `listp', `numberp', `stringp', `vectorp', `throw',
  799.      `fboundp', `boundp', `symbolp', `get', `put', `signal', `return',
  800.      `reverse', `nreverse', `assoc', `assq', `rassoc', `rassq', `last',
  801.      `mapcar', `mapc', `member', `memq', `delete', `delq', `delete-if',
  802.      `delete-if-not', `copy-sequence', `sequencep', `functionp',
  803.      `special-formp', `subrp', `eql', `set-current-buffer',
  804.      `current-buffer', `bufferp', `markp', `windowp'.
  805.  
  806.    * When a file is being compiled each top-level form it contains is
  807.      inspected to see if it should be compiled into a byte-code form.
  808.      Different types of form are processed in different ways:
  809.  
  810.         * Function and macro definitions have their body forms compiled
  811.           into a single byte-code form. The doc-string and interactive
  812.           declaration are not compiled.
  813.  
  814.         * Calls to the `require' function are evaluated then the
  815.           unevaluated form is written as-is to the output file. The
  816.           reason it is evaluated is so that any macros defined in the
  817.           required module are loaded before they are called by the
  818.           program being compiled.
  819.  
  820.         * If the form is a list form (*note List Forms::.) and the
  821.           symbol which is the car of the list is one of:
  822.  
  823.           `if', `cond', `when', `unless', `let', `let*', `catch',
  824.           `unwind-protect', `error-protect', `with-buffer',
  825.           `with-window', `progn', `prog1', `prog2', `while', `and',
  826.           `or'.
  827.  
  828.           then the form is compiled. Otherwise it is just written to
  829.           the output file in its uncompiled state.
  830.  
  831.      If your program contains a lot of top-level forms which you know
  832.      will not be compiled automatically, consider putting them in a
  833.      `progn' block to make the compiler coalesce them into one
  834.      byte-code form.
  835.  
  836. 
  837. File: jade.info,  Node: Disassembly,  Prev: Compilation Tips,  Up: Compiled Lisp
  838.  
  839. Disassembly
  840. -----------
  841.  
  842.    It is possible to disassemble byte-code forms; originally this was so
  843. I could figure out why the compiler wasn't working but if you're
  844. curious about how the compiler compiles a form it may be of use to you.
  845.  
  846.    Naturally, the output of the disassembler is a listing in Jade's
  847. pseudo-machine language -- it won't take a byte-code form and produce
  848. the equivalent Lisp code!
  849.  
  850.  - Command: disassemble-fun FUNCTION &optional STREAM
  851.      This function disassembles the compile Lisp function FUNCTION. It
  852.      writes a listing to the output stream STREAM (normally the value
  853.      of the `standard-output' variable).
  854.  
  855.      When called interactively it will prompt for a function to
  856.      disassemble.
  857.  
  858.    When reading the output of the disassembler bear in mind that Jade
  859. simulates a stack machine for the code to run on. All calculations are
  860. performed on the stack, the value left on the stack when the piece of
  861. code ends is the value of the byte-code form.
  862.  
  863. 
  864. File: jade.info,  Node: Hooks,  Next: Buffers,  Prev: Compiled Lisp,  Up: Programming Jade
  865.  
  866. Hooks
  867. =====
  868.  
  869.    A "hook" allows you to wedge your own pieces of Lisp code into the
  870. editor's operations. These pieces of code are evaluated via the hook
  871. and the result is available to the hook's caller.
  872.  
  873. * Menu:
  874.  
  875. * Functions As Hooks::          Some hooks are a single function,
  876. * Normal Hooks::                Others may be a list of pieces of code
  877.                                   to evaluate.
  878. * Standard Hooks::              A table of the predefined hooks
  879.  
  880. 
  881. File: jade.info,  Node: Functions As Hooks,  Next: Normal Hooks,  Up: Hooks
  882.  
  883. Functions As Hooks
  884. ------------------
  885.  
  886.    Some hooks only allow a single piece of code to be hooked in. Usually
  887. a normally-undefined function is used; to install your hook defined a
  888. function with the name of the hook. When the hook is to be evaluated
  889. the function is called.
  890.  
  891.    Generally the name of the hook's function will end in `-function'.
  892.  
  893.    An alternative scheme is to use a variable to store the hook, its
  894. value should be the function to call.
  895.  
  896. 
  897. File: jade.info,  Node: Normal Hooks,  Next: Standard Hooks,  Prev: Functions As Hooks,  Up: Hooks
  898.  
  899. Normal Hooks
  900. ------------
  901.  
  902.    This is the standard type of hook, it is a variable whose value is a
  903. list of functions. When the hook is evaluated each of the named
  904. functions will be called in turn until one of them returns a value
  905. which is not `nil'. This value becomes the value of the hook and no
  906. more of the functions are called. If all of the functions in the hook
  907. return `nil' the value of the hook is `nil'.
  908.  
  909.    The names of hooks of this type will normally end in `-hook'.
  910.  
  911.  - Function: add-hook HOOK FUNCTION &optional AT-END
  912.      This function adds a new function FUNCTION to the list of functions
  913.      installed in the (list) hook HOOK (a symbol).
  914.  
  915.      If AT-END is non-`nil' the new function is added at the end of the
  916.      hook's list of functions (and therefore will be called last when
  917.      the hook is evaluated), otherwise the new function is added to the
  918.      front of the list.
  919.  
  920.           text-mode-hook
  921.               => (fill-mode-on)
  922.           (add-hook 'text-mode-hook 'my-function)
  923.               => (my-function fill-mode-on)
  924.  
  925.  - Function: remove-hook HOOK FUNCTION
  926.      This function removes the function FUNCTION from the list of
  927.      functions stored in the (list) hook HOOK (a symbol).
  928.  
  929.      *All* instances of FUNCTION are deleted from the hook.
  930.  
  931.           text-mode-hook
  932.               => (my-function fill-mode-on)
  933.           (remove-hook 'text-mode-hook 'my-function)
  934.               => (fill-mode-on)
  935.  
  936.  - Function: eval-hook HOOK &rest ARGS
  937.      Evaluates the (list) hook HOOK (a symbol) with argument values
  938.      ARGS.
  939.  
  940.      Each function stored in the hook is applied to the ARGS in turn
  941.      until one returns non-`nil'. This non-`nil' value becomes the
  942.      result of the hook. If all functions return `nil' then the result
  943.      of the hook is `nil'.
  944.  
  945.    Note that most functions which are installed in hooks should always
  946. return `nil' to ensure that all the functions in the hook are evaluated.
  947.  
  948. 
  949. File: jade.info,  Node: Standard Hooks,  Prev: Normal Hooks,  Up: Hooks
  950.  
  951. Standard Hooks
  952. --------------
  953.  
  954.    This is a table of the predefined hooks in Jade:
  955.  
  956. `asm-cpp-mode-hook'
  957.      *Note Asm mode::.
  958.  
  959. `asm-mode-hook'
  960.      *Note Asm mode::.
  961.  
  962. `auto-save-hook'
  963.      *Note Controlling Auto-Saves::.
  964.  
  965. `buffer-menu-mode-hook'
  966. `c-mode-hook'
  967.      *Note C mode::.
  968.  
  969. `destroy-window-hook'
  970.      *Note Closing Windows::.
  971.  
  972. `gdb-hook'
  973. `idle-hook'
  974.      *Note Idle Actions::.
  975.  
  976. `indented-text-mode-hook'
  977.      *Note Indented-Text mode::.
  978.  
  979. `insert-file-hook'
  980.      *Note Reading Files Into Buffers::.
  981.  
  982. `kill-buffer-hook'
  983.      *Note Destroying Buffers::.
  984.  
  985. `lisp-mode-hook'
  986.      *Note Lisp mode::.
  987.  
  988. `make-window-hook'
  989.      *Note Opening Windows::.
  990.  
  991. `open-file-hook'
  992.      *Note Reading Files Into Buffers::.
  993.  
  994. `read-file-hook'
  995.      *Note Reading Files Into Buffers::.
  996.  
  997. `shell-callback-function'
  998. `shell-mode-hook'
  999. `texinfo-mode-hook'
  1000.      *Note Texinfo mode::.
  1001.  
  1002. `text-mode-hook'
  1003.      *Note Text mode::.
  1004.  
  1005. `unbound-key-hook'
  1006.      *Note Event Loop::.
  1007.  
  1008. `window-closed-hook'
  1009.      *Note Event Loop::.
  1010.  
  1011. `write-file-hook'
  1012.      *Note Writing Buffers::.
  1013.  
  1014. 
  1015. File: jade.info,  Node: Buffers,  Next: Windows,  Prev: Hooks,  Up: Programming Jade
  1016.  
  1017. Buffers
  1018. =======
  1019.  
  1020.    A "buffer" is a Lisp object containing a `space' in which files (or
  1021. any pieces of text) may be edited, either directly by the user or by
  1022. Lisp programs.
  1023.  
  1024.    Each window (*note Windows::.) may display any one buffer at any
  1025. time, the buffer being displayed by the current window is known as the
  1026. "current buffer". This is the buffer which functions will operate on by
  1027. default.
  1028.  
  1029.  - Function: bufferp OBJECT
  1030.      Returns `t' if its argument is a buffer.
  1031.  
  1032. * Menu:
  1033.  
  1034. * Buffer Attributes::           Data contained in a buffer object
  1035. * Creating Buffers::            How to create empty buffers
  1036. * Modifications to Buffers::    Is a buffer modified?
  1037. * Read-Only Buffers::           Unmodifiable buffers
  1038. * Destroying Buffers::          Deleting a buffer and its contents
  1039. * Special Buffers::             Program-controlled buffers
  1040. * The Buffer List::             Each window has a list of buffers
  1041. * The Current Buffer::          One buffer is the default buffer
  1042.  
  1043. 
  1044. File: jade.info,  Node: Buffer Attributes,  Next: Creating Buffers,  Up: Buffers
  1045.  
  1046. Buffer Attributes
  1047. -----------------
  1048.  
  1049.    All buffer objects store a set of basic attributes, some of these
  1050. are:
  1051.  
  1052. "name"
  1053.      Each buffer has a unique name.
  1054.  
  1055.       - Function: buffer-name &optional BUFFER
  1056.           Returns the name of the buffer BUFFER, or of the current
  1057.           buffer if BUFFER is undefined.
  1058.  
  1059.                (buffer-name)
  1060.                    => "programmer.texi"
  1061.  
  1062.       - Function: set-buffer-name NAME &optional BUFFER
  1063.           Sets the name of the buffer BUFFER (or the current buffer) to
  1064.           the string NAME.
  1065.  
  1066.           Note that NAME is not checked for uniqueness, use the
  1067.           `make-buffer-name' function if you want a guaranteed unique
  1068.           name.
  1069.  
  1070.       - Function: make-buffer-name NAME
  1071.           Returns a unique version of the string NAME so that no
  1072.           existing buffer has the same string as its name. If a clash
  1073.           occurs a suffix `<N>' is appended to NAME, where N is the
  1074.           first number which guarantees the uniqueness of the result.
  1075.  
  1076.       - Function: get-buffer NAME
  1077.           Returns the existing buffer whose name is NAME, or `nil' if
  1078.           no such buffer exists.
  1079.  
  1080. "file name"
  1081.      Since buffers often contain text belonging to files on disk the
  1082.      buffer stores the name of the file its text was read from. *Note
  1083.      Editing Files::.
  1084.  
  1085.       - Function: buffer-file-name &optional BUFFER
  1086.           Returns the name of the file stored in BUFFER. If no file is
  1087.           stored in the buffer the null string (`') is returned.
  1088.  
  1089.                (buffer-file-name)
  1090.                    => "man/programmer.texi"
  1091.  
  1092.       - Function: set-buffer-file-name NAME &optional BUFFER
  1093.           This function sets the file-name of the buffer to the string
  1094.           NAME.
  1095.  
  1096.       - Function: get-file-buffer FILE-NAME
  1097.           Searches for an existing buffer containing the file FILE-NAME
  1098.           then returns it, or `nil' if no such buffer exists.
  1099.  
  1100. "contents"
  1101.      The contents of a buffer is the text it holds. This is stored as
  1102.      an array of lines. *Note Text::.
  1103.  
  1104. "tab size"
  1105.      This is the spacing of tab stops. When the contents of the buffer
  1106.      is being displayed (in a window) this value is used.
  1107.  
  1108.       - Variable: tab-size
  1109.           A buffer-local variable which holds the size of tab stops in
  1110.           the buffer.
  1111.  
  1112. "glyph table"
  1113.      Each buffer has its own glyph table which is used when the buffer
  1114.      is being displayed. *Note Buffer Glyph Tables::.
  1115.  
  1116. "local variables"
  1117.      Each buffer can have its own value for any variable, these local
  1118.      values are stored in an alist which lives in the buffer object.
  1119.      *Note Buffer-Local Variables::.
  1120.  
  1121.       - Function: buffer-variables &optional BUFFER
  1122.           Returns the alist of local variables in the buffer. Each
  1123.           alist element is structured like, `(SYMBOL . LOCAL-VALUE)'.
  1124.  
  1125. "modification counter"
  1126.      Each modification made to the buffer increments its modification
  1127.      counter.  *Note Modifications to Buffers::.
  1128.  
  1129.       - Function: buffer-changes &optional BUFFER
  1130.           Returns the number of modifications made to the buffer since
  1131.           it was created.
  1132.  
  1133. "undo information"
  1134.      When a modification is made to a buffer enough information is
  1135.      recorded so that the modification can later be undone. *Note
  1136.      Controlling Undo::.
  1137.  
  1138.    All other buffer-specific information is kept in buffer-local
  1139. variables.
  1140.  
  1141. 
  1142. File: jade.info,  Node: Creating Buffers,  Next: Modifications to Buffers,  Prev: Buffer Attributes,  Up: Buffers
  1143.  
  1144. Creating Buffers
  1145. ----------------
  1146.  
  1147.  - Function: make-buffer NAME
  1148.      Creates and returns a new buffer object. Its name will be a unique
  1149.      version of NAME (created by the `make-buffer-name' function).
  1150.  
  1151.      The buffer will be totally empty and all its attributes will have
  1152.      standard values.
  1153.  
  1154.           (make-buffer "foo")
  1155.               => #<buffer foo>
  1156.  
  1157.  - Function: open-buffer NAME
  1158.      If no buffer called NAME exists, creates a new buffer of that name
  1159.      and adds it to the end of each windows `buffer-list'. This function
  1160.      always returns the buffer called NAME.
  1161.  
  1162.    For more ways of creating buffers see *Note Editing Files::.
  1163.  
  1164. 
  1165. File: jade.info,  Node: Modifications to Buffers,  Next: Read-Only Buffers,  Prev: Creating Buffers,  Up: Buffers
  1166.  
  1167. Modifications to Buffers
  1168. ------------------------
  1169.  
  1170.    Each buffer maintains a counter which is incremented each time the
  1171. contents of the buffer is modified. It also holds the value of this
  1172. counter when the buffer was last saved, when the two numbers are
  1173. different the buffer is classed as have being "modified".
  1174.  
  1175.  - Function: buffer-modified-p &optional BUFFER
  1176.      This function returns `t' when the buffer has been modified.
  1177.  
  1178.  - Function: set-buffer-modified BUFFER STATUS
  1179.      Sets the modified status of the buffer BUFFER. When STATUS is
  1180.      `nil' the buffer will appear to be unmodified, otherwise it will
  1181.      look modified.
  1182.  
  1183. 
  1184. File: jade.info,  Node: Read-Only Buffers,  Next: Destroying Buffers,  Prev: Modifications to Buffers,  Up: Buffers
  1185.  
  1186. Read-Only Buffers
  1187. -----------------
  1188.  
  1189.    When a buffer has been marked as being read-only no modifications
  1190. may be made to its contents (neither by the user nor a Lisp program).
  1191.  
  1192.  - Function: buffer-read-only-p &optional BUFFER
  1193.      Returns `t' when the buffer is read-only.
  1194.  
  1195.  - Function: set-buffer-read-only BUFFER READ-ONLY
  1196.      When READ-ONLY is non-`nil' the buffer BUFFER is marked as being
  1197.      read-only, otherwise it is read-write.
  1198.  
  1199.  - Variable: inhibit-read-only
  1200.      When this variable is non-`nil' any buffer may be modified, even if
  1201.      it is marked as being read-only.
  1202.  
  1203.      Lisp programs can temporarily bind a non-`nil' value to this
  1204.      variable when they want to edit one of their normally read-only
  1205.      buffers.
  1206.  
  1207. 
  1208. File: jade.info,  Node: Destroying Buffers,  Next: Special Buffers,  Prev: Read-Only Buffers,  Up: Buffers
  1209.  
  1210. Destroying Buffers
  1211. ------------------
  1212.  
  1213.    Since all Lisp objects have indefinite extent (i.e. they live until
  1214. there are no references to them) a buffer will be automatically
  1215. destroyed when all references to it disappear.
  1216.  
  1217.    Alternatively one of the following functions can be used to
  1218. explicitly kill a buffer; the buffer object will still exist but all
  1219. data associated with it (including the text it contains) will be
  1220. released.
  1221.  
  1222.  - Command: kill-buffer BUFFER
  1223.      Removes the buffer BUFFER (a buffer or the name of a buffer) from
  1224.      all windows (any windows displaying BUFFER will be changed to
  1225.      display the previous buffer they showed) and destroys the buffer.
  1226.  
  1227.      The hook `kill-buffer-hook' is evaluated before the buffer is
  1228.      killed with BUFFER as its argument.
  1229.  
  1230.      If the buffer contains unsaved modifications the user will be asked
  1231.      if they really want to lose them before the buffer is killed (if
  1232.      the answer is yes).
  1233.  
  1234.      When called interactively a buffer will be prompted for.
  1235.  
  1236.  - Hook: kill-buffer-hook
  1237.      Hook called by `kill-buffer' before it does anything. If a function
  1238.      in the hook doesn't want the buffer deleted it should signal some
  1239.      sort of error.
  1240.  
  1241.  - Function: destroy-buffer BUFFER
  1242.      This function may be used to remove all data stored in the buffer
  1243.      object manually. Also, any marks in this buffer are made
  1244.      non-resident.
  1245.  
  1246.      After applying this function to a buffer the buffer will contain
  1247.      one empty line.
  1248.  
  1249.      Use this function wisely, there are no safety measures taken to
  1250.      ensure valuable data is not lost.
  1251.  
  1252. 
  1253. File: jade.info,  Node: Special Buffers,  Next: The Buffer List,  Prev: Destroying Buffers,  Up: Buffers
  1254.  
  1255. Special Buffers
  1256. ---------------
  1257.  
  1258.    When a buffer is "special"  it means that it is controlled by a Lisp
  1259. program, not by the user typing into it (although this can happen as
  1260. well).
  1261.  
  1262.    Special buffers are used for things like the `*jade*' or `*Info*'
  1263. buffers (in fact most of the buffers whose names are surrounded by
  1264. asterisks are special).
  1265.  
  1266.    What the special attribute actually does is make sure that the
  1267. buffer is never truly killed (`kill-buffer' removes it from each
  1268. window's `buffer-list' but doesn't call `destroy-buffer' on it) and
  1269. modifications don't cause the `+' flag to appear in the status line.
  1270.  
  1271.  - Function: buffer-special-p &optional BUFFER
  1272.      Returns `t' if the buffer is marked as being special.
  1273.  
  1274.  - Function: set-buffer-special BUFFER SPECIAL
  1275.      Sets the value of the special flag in the buffer BUFFER to the
  1276.      value of SPECIAL (`nil' means non-special, anything else means
  1277.      special).
  1278.  
  1279.    Another type of special buffer exists; the "mildly-special buffer".
  1280.  
  1281.  - Variable: mildly-special-buffer
  1282.      When this buffer-local variable is set to `t' (it is `nil' by
  1283.      default) and the buffer is marked as being special, the
  1284.      `kill-buffer' function is allowed to totally destroy the buffer.
  1285.  
  1286. 
  1287. File: jade.info,  Node: The Buffer List,  Next: The Current Buffer,  Prev: Special Buffers,  Up: Buffers
  1288.  
  1289. The Buffer List
  1290. ---------------
  1291.  
  1292.    Each window (*note Windows::.) has a list of buffers which may be
  1293. displayed in that window. It is arranged is "most-recently-used" order,
  1294. so that the car of the list is the buffer currently being shown in the
  1295. window, the second element the window previously being shown and so on.
  1296.  
  1297.  - Variable: buffer-list
  1298.      A variable, local to each window, which contains a list of the
  1299.      buffers available in the window. The list is maintained in
  1300.      most-recently-used order.
  1301.  
  1302.           buffer-list
  1303.               => (#<buffer programmer.texi> #<buffer *Help*>
  1304.                          #<buffer buffers.c> #<buffer buffers.jl>
  1305.                          #<buffer edit.c> #<buffer edit.h>
  1306.                          #<buffer *jade*> #<buffer lisp.jl>
  1307.                          #<buffer *compilation*> #<buffer *Info*>)
  1308.  
  1309.    Generally each window's `buffer-list' contains the same buffers, each
  1310. window has its own value for the variable so it can be kept in the
  1311. correct order (each window will probably be displaying different
  1312. buffers).
  1313.  
  1314.  - Function: add-buffer BUFFER
  1315.      This function ensures that the buffer BUFFER is in each window's
  1316.      `buffer-list'. If it isn't it is appended to the end of the list.
  1317.  
  1318.  - Function: remove-buffer BUFFER
  1319.      Deletes all references to BUFFER in each window's `buffer-list'.
  1320.  
  1321.  - Command: bury-buffer &optional BUFFER ALL-WINDOWS
  1322.      Puts BUFFER (or the currently displayed buffer) at the end of the
  1323.      current window's `buffer-list' then switch to the buffer at the
  1324.      head of the list.
  1325.  
  1326.      If ALL-WINDOWS is non-`nil' this is done in all windows (the same
  1327.      buffer will be buried in each window though).
  1328.  
  1329.  - Command: rotate-buffers-forward
  1330.      Moves the buffer at the head of the `buffer-list' to be last in the
  1331.      list, the new head of the `buffer-list' is displayed in the current
  1332.      window.
  1333.  
  1334.